#include "wifiitem.h"
#include "ui_wifiitem.h"

WiFiItem::WiFiItem(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::WiFiItem)
{
    ui->setupUi(this);

    //部件事件过滤的注册
    ui->pushButton->installEventFilter(this);
    ui->pushButton_2->installEventFilter(this);

    QFont font;
    font.setFamily("Microsoft YaHei");//设置字体
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    ui->pushButton->setFont(font);
    ui->pushButton_2->setFont(font);
}

WiFiItem::~WiFiItem()
{
    delete ui;
}

//点击修改按钮
void WiFiItem::on_pushButton_clicked()
{
    emit sendWiFiItem("1");
}

//点击删除按钮
void WiFiItem::on_pushButton_2_clicked()
{
    emit sendWiFiItem("2");
}

bool WiFiItem::eventFilter(QObject *watched, QEvent *event)
{
    if(ui->pushButton==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标默认样式
        }
    }
    if(ui->pushButton_2==watched)
    {
        if(QEvent::Enter==event->type())
        {
            setCursor(Qt::PointingHandCursor); //设置鼠标样式
        }
        else if(QEvent::Leave==event->type())
        {
            setCursor(Qt::ArrowCursor); //设置鼠标默认样式
        }
    }

    return QObject::eventFilter(watched,event);
}
